{extend name="../../admin/view/main"}

{block name="button"}

{if auth("black_add")}
<button data-action='{:url("black_add")}' data-rule="openid#{key}" data-csrf="{:systoken('black_add')}" class='layui-btn layui-btn-sm layui-btn-primary'>拉入黑名单</button>
{/if}

{if auth("black_del")}
<button data-action='{:url("black_del")}' data-rule="openid#{key}" data-csrf="{:systoken('black_del')}" class='layui-btn layui-btn-sm layui-btn-primary'>移出黑名单</button>
{/if}

{if auth("sync")}
<button data-queue='{:url("sync")}' data-confirm="是否要创建后台任务同步用户数据？" class='layui-btn layui-btn-sm layui-btn-primary'>同步用户数据</button>
{/if}

{/block}

{block name="content"}
<div class="think-box-shadow table-block">
    {include file='fans/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </th>
            <th width="180px" class='text-left nowrap'>微信昵称</th>
            <th width="180px"></th>
            <th width="150px" class='text-left nowrap'>性别语言</th>
            <th width="180px" class='text-left nowrap'>关注时间</th>
            <th width="80px"></th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.openid}' type='checkbox'></label>
            </td>
            <td class='text-left nowrap relative layui-elip'>
                <img alt="" src="{$vo.headimgurl|default=''}" data-tips-image class="inline-block text-top margin-right-5" style="width:40px;height:40px">
                <div class="inline-block">
                    昵称：{$vo.nickname|default='--'}<br>
                    区域：{$vo.country|default='--'} {$vo.province} {$vo.city}
                </div>
            </td>
            <td class="text-left padding-0">
                <div style="max-height:60px;overflow:auto">{foreach $vo.tags as $t}<p><span class="layui-badge layui-bg-cyan margin-right-5">{$t|default='--'}</span></p>{/foreach}</div>
            </td>
            <td class='text-left nowrap'>
                性别：{switch name='vo.sex'}{case value='1'}男{/case}{case value='2'}女{/case}{default}未知{/switch}<br>
                语言：{$vo.language|raw}
            </td>
            <td class='text-left nowrap'>
                日期：{$vo.subscribe_at|format_datetime|str_replace=' ','<br>时间：',###|raw}
            </td>
            <td class='text-center nowrap'>
                {eq name='vo.subscribe' value='0'}<span class="layui-badge">未关注</span>{else}<span class="layui-badge layui-bg-green">已关注</span>{/eq}
                <br>
                {eq name='vo.is_black' value='0'}<span class="layui-badge layui-bg-green">未拉黑</span>{else}<span class="layui-badge">已拉黑</span>{/eq}
            </td>
            <td class="nowrap">

                {if auth('black_add') and $vo.is_black eq 0}
                <a class="layui-btn layui-btn-sm" data-action="{:url('black_add')}" data-value="openid#{$vo.openid}" data-csrf="{:systoken('black_add')}">拉 黑</a>
                {/if}

                {if auth('black_del') and $vo.is_black eq 1}
                <a class="layui-btn layui-btn-sm" data-action="{:url('black_del')}" data-value="openid#{$vo.openid}" data-csrf="{:systoken('black_del')}">移 出</a>
                {/if}

                {if auth("remove")}
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除该用户吗？">删 除</a>
                {/if}

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
{/block}
